<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Other HTTP Headers [Universal Feed Parser]</title>
<link rel="stylesheet" href="feedparser.css" type="text/css">
<link rev="made" href="mailto:mark@diveintomark.org">
<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
<meta name="keywords" content="RSS, Atom, CDF, XML, feed, parser, Python">
<link rel="start" href="index.html" title="Documentation">
<link rel="up" href="http.html" title="HTTP Features">
<link rel="prev" href="http-authentication.html" title="Password-Protected Feeds">
<link rel="next" href="annotated-examples.html" title="Annotated Examples">
</head>
<body id="feedparser-org" class="docs">
<div class="z" id="intro"><div class="sectionInner"><div class="sectionInner2">
<div class="s" id="pageHeader">
<h1><a href="/"><span>Universal Feed Parser</span></a></h1>
<p><span>Parse RSS and Atom feeds in Python.  3000 unit tests.  Open source.</span></p>
</div>
<div class="s" id="quickSummary"><ul>
<li class="li1">
<a href="http://sourceforge.net/projects/feedparser/"><span>Download</span></a> ·</li>
<li class="li2">
<a href="http://feedparser.org/docs/"><span>Documentation</span></a> ·</li>
<li class="li3">
<a href="http://feedparser.org/tests/"><span>Unit tests</span></a> ·</li>
<li class="li4"><a href="http://sourceforge.net/tracker/?func=browse&amp;group_id=112328&amp;atid=661937"><span>Report a bug</span></a></li>
</ul></div>
</div></div></div>
<div id="main"><div id="mainInner">
<p id="breadcrumb">You are here: <a href="index.html">Documentation</a> → <a href="http.html">HTTP Features</a> → <span class="thispage">Other HTTP Headers</span></p>
<div class="section" lang="en">
<div class="titlepage">
<div>
<div><h2 class="title">
<a name="http.other" class="skip" href="#http.other" title="link to this section"><img src="images/permalink.gif" alt="[link]" title="link to this section" width="8" height="9"></a> Other <acronym title="Hypertext Transfer Protocol">HTTP</acronym> Headers</h2></div>
<div><div class="abstract">
<h3 class="title"></h3>
<p>When you download a feed from a remote web server, <span class="application">Universal Feed Parser</span> exposes the complete set of <acronym title="Hypertext Transfer Protocol">HTTP</acronym> headers as a dictionary.</p>
</div></div>
</div>
<div></div>
</div>
<div class="example">
<a name="example.http.headers" class="skip" href="#example.http.headers" title="link to this example"><img src="images/permalink.gif" alt="[link]" title="link to this example" width="8" height="9"></a> <h3 class="title">Example: Accessing other <acronym title="Hypertext Transfer Protocol">HTTP</acronym> headers</h3>
<pre class="screen"><tt class="prompt">&gt;&gt;&gt; </tt><span class="userinput"><font color='navy'><b>import</b></font> feedparser</span>
<tt class="prompt">&gt;&gt;&gt; </tt><span class="userinput">d = feedparser.parse('<a href="http://feedparser.org/docs/examples/atom03.xml">http://feedparser.org/docs/examples/atom03.xml</a>')</span>
<tt class="prompt">&gt;&gt;&gt; </tt><span class="userinput">d.headers</span>
<span class="computeroutput">{'date': 'Fri, 11 Jun 2004 23:57:50 GMT',
 'server': 'Apache/2.0.49 (Debian GNU/Linux)',
 'last-modified': 'Fri, 11 Jun 2004 23:00:34 GMT',
 'etag': '"6c132-941-ad7e3080"',
 'accept-ranges': 'bytes',
 'vary': 'Accept-Encoding,User-Agent',
 'content-encoding': 'gzip',
 'content-length': '883',
 'connection': 'close',
 'content-type': 'application/xml'}</span></pre>
</div>
</div>
<div style="float: left">← <a class="NavigationArrow" href="http-authentication.html">Password-Protected Feeds</a>
</div>
<div style="text-align: right">
<a class="NavigationArrow" href="annotated-examples.html">Annotated Examples</a> →</div>
<hr style="clear:both">
<div class="footer"><p class="copyright">Copyright © 2004, 2005, 2006 Mark Pilgrim</p></div>
</div></div>
</body>
</html>
